<template>
	<view class="page-box">
		<view class="module-box" >
			<view class="item-one-box" >
				<view class="title-money-box">
					<view class="title-box">
						可开发票总余额(元）
					</view>
					<view class="money-box">
						¥{{invoiceInfo.kaipiao_money}}
					</view>
				</view>
				<view class="invoice-btn-box" @click="goPage('pages/index/openInvoice')">
					开发票
				</view>
			</view>
			</view>
			<view class="module-box" v-for="(item,index) in invoiceInfo.data" :key='index'>
			<view class="item-two-box">
				<view class="title-status-box">
					<view class="title-box">
						{{item.header_name}}
					</view>
					<view class="status-box">
						{{item.status_text}}
					</view>
				</view>
				<view class="invoice-type-box">
					{{item.content}}
				</view>
				<view class="money-box">
					¥{{item.amount}}
				</view>
				<view class="time-box">
					{{ $u.timeFormat(item.createtime, 'yyyy-mm-dd hh:MM:ss') }}
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				invoiceInfo:{}
			}
		},
		onShow(){
			this.getList()
		},
		methods: {
			getList(){
					let params = {
						page:1,
						limit:9999
					};
					let self = this
					self.$https(
						'mine.invoiceList',
						{
							data: params
						},
						'加载中...'
					).then(res => {
						if (res.code === 1) {
							self.invoiceInfo = res.data || {}
						}else{
							self.invoiceInfo = {
								kaipiao_money:0,
								data:[]
							}
						}
					});
			},
			goPage(path) {
				uni.navigateTo({
					url: path
				});
			}
		}
	}
</script>

<style scoped lang="scss">
	.page-box {
		width: 100%;
		height: 100vh;
		padding: 24rpx;
		overflow-y: scroll;
	}

	.module-box {
		width: 100%;
	}

	.item-one-box {
		width: 100%;
		height: 200rpx;
		background-color: #FD5B5A;
		border-radius: 16rpx;
		display: flex;
		align-items: center;
		padding: 14rpx 20rpx 14rpx 30rpx;
		margin-bottom: 20rpx;

		.title-money-box {
			width: calc(100% - 120rpx);
			height: 100%;
			display: flex;
			flex-direction: column;
			justify-content: center;

			.title-box {
				font-size: 32rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #FFFFFF;
			}

			.money-box {
				margin-top: 8rpx;
				font-size: 48rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #FFFFFF;
			}
		}

		.invoice-btn-box {
			width: 150rpx;
			height: 70rpx;
			line-height: 70rpx;
			text-align: center;
			background: #FFFFFF;
			border-radius: 40rpx;
			font-size: 30rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #FC5351;
		}
	}

	.item-two-box {
		width: 100%;
		height: 270rpx;
		background-color: #fff;
		border-radius: 16rpx;
		padding: 30rpx 20rpx 30rpx 30rpx;
		margin-bottom: 20rpx;
		display: flex;
		flex-direction: column;
		justify-content: space-around;

		.title-status-box {
			width: 100%;
			height: 48rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.title-box {
				font-size: 32rpx;
				font-family: PingFang SC-Bold, PingFang SC;
				font-weight: bold;
				color: #333333;
			}

			.status-box {
				font-size: 24rpx;
				font-family: PingFang SC-Medium, PingFang SC;
				font-weight: 500;
				color: #666666;
			}
		}

		.invoice-type-box {
			width: 100%;
			font-size: 28rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #666666;
		}

		.money-box {
			font-size: 36rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #FD5B5A;
		}

		.time-box {
			font-size: 28rpx;
			font-family: PingFang SC-Regular, PingFang SC;
			font-weight: 400;
			color: #999999;
		}
	}
</style>
